import { createRouter, createWebHistory } from 'vue-router';

export default createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '',
      component: () => import('@pages/index.vue'),
      children: [
        { path: '', redirect: '/all' },
        {
          path: 'index',
          component: () => import('@pages/home/home.vue'),
        },
        {
          path: 'join',
          component: () => import('@pages/join/join.vue'),
        },
        {
          path: 'all',
          component: () => import('@pages/all/all.vue'),
        },
        {
          path: 'login',
          component: () => import('@pages/login/login.vue'),
        },
        {
          path: 'release',
          component: () => import('@pages/release/release.vue'),
        },
        {
          path: 'user/:id',
          component: () => import('@pages/user/user.vue'),
        },
        {
          path: 'mine/:id',
          component: () => import('@pages/user/mine.vue'),
        },
        {
          path: 'detail',
          component: () => import('@pages/detail/detail.vue'),
        },
        {
          path: 'about',
          component: () => import('@pages/about/about.vue'),
        },
        {
          path: 'register',
          component: () => import('@pages/login/register.vue'),
        },
        {
          path: '404',
          name: 'notFound',
          component: () => import('@pages/404.vue'),
        },
        {
          path: 'pathMatch(.*)*',
          redirect: { name: 'notFound' },
        },
      ],
    },
    {
      path: '/404',
      component: () => import('@pages/404.vue'),
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404',
    },
  ],
});
